package com.ershi.controller;


import com.ershi.model.AddressDO;
import com.ershi.result.Result;
import com.ershi.service.AddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 电商-公司收发货地址表 前端控制器
 * </p>
 *
 * @author 二十
 * @since 2021-01-26
 */
@RestController
@RequestMapping("/api/address/v1/")
@Api(tags = "收货地址模块接口文档")
public class AddressController {

    @Resource
    private AddressService addressService;

    /**
     *  http://localhost:9001/swagger-ui/index.html#/
     *  根据ID获取地址信息
     * @param id
     * @return
     */
    @ApiOperation(value = "根据ID获取地址信息")
    @GetMapping("detail/{address_id}")
    public Result<AddressDO> detail(
            @ApiParam(value = "地址ID",required = true)
            @PathVariable("address_id") Long id){

        return Result.buildSuccess(addressService.detail(id));
    }
}

